{% extends "shuup/front/dashboard/dashboard.jinja" %}
{% from "shuup/customer_information/macros/address.jinja" import render_address_forms, render_address_forms_js %}
{% from "shuup/customer_information/macros/buttons.jinja" import user_account_button, save_changes_button %}
{% from "shuup/customer_information/macros/contact.jinja" import render_company_contact_form %}

{% block title %}{% trans %}Company account information{% endtrans %}{% endblock %}
{% block content_title %}{% trans %}Company account information{% endtrans %}{% endblock %}

{% block breadcrumb %}
    {% call macros.breadcrumb() %}
        {{ macros.render_breadcrumb_item("/", _("Home")) }}
        {{ macros.render_breadcrumb_item(url("shuup:dashboard"), _("Dashboard")) }}
        {{ macros.render_breadcrumb_item(None,  _("Company account information"), True) }}
    {% endcall %}
{% endblock %}

{% block dashboard_content %}
    <div class="user-account">
        <form role="form" method="post" action="">
            {% if pending_company_approval %}
                <p>{% trans %}You have already linked your account to a company and it is pending approval.{% endtrans %}</p>
            {% else %}
                {% csrf_token %}
                {% for field in form.contact.hidden_fields() %}{{ field|safe }}{% endfor %}
                <div class="btn-toolbar pull-right" role="toolbar">
                    {{ user_account_button() }}
                    {{ save_changes_button() }}
                </div>
                <div class="clearfix"></div>
                {{ render_company_contact_form(form.contact) }}
                {{ render_address_forms(form.billing, form.shipping) }}
                <div class="btn-toolbar pull-right" role="toolbar">
                    {{ save_changes_button() }}
                </div>
                <div class="clearfix"></div>
            {% endif %}
        </form>
    </div>
{% endblock %}

{% block extrajs %}
    {{ render_address_forms_js() }}
{% endblock %}
